import { Entity, Column, PrimaryGeneratedColumn, CreateDateColumn, UpdateDateColumn, ManyToOne, JoinColumn } from 'typeorm';
import { Users } from '../../users/entities/user.entity';

@Entity({ name: 'customer_quotation' })
export class CustomerQuotation {
  @PrimaryGeneratedColumn({ name: '_Identify' })
  _Identify: number;

  @Column({ name: '_Locked', type: 'bit', default: false })
  _Locked: boolean;

  @Column({ name: '_SortKey', type: 'int', default: 0 })
  _SortKey: number;

  @Column({ name: 'title' })
  title: string;

  @Column({ name: 'customername' })
  customername: string;

  @Column({ name: 'tel' })
  tel: string;

  @Column({ name: 'wechat', nullable: true })
  wechat: string;

  @Column({ name: 'wangwangid', nullable: true })
  wangwangid: string;

  @Column({ name: 'address', nullable: true })
  address: string;

  @Column({ name: 'content', type: 'text' })
  content: string;

  @Column({ name: 'picture', nullable: true })
  picture: string;

  @Column({ name: 'author', type: 'int' })
  author: number;

  @ManyToOne(() => Users, { eager: true })
  @JoinColumn({ name: 'author', referencedColumnName: 'id' })
  authorUser: Users;

  @Column({ name: 'quoteid' })
  quoteid: string;

  @CreateDateColumn({ name: 'date' })
  date: Date;

  // @Column({ name: 'deleted', type: 'bit', default: false })
  // deleted: boolean;
} 